package com.ruoyi.car.service.impl;

import java.util.List;

import com.ruoyi.car.vo.UseAndCarListAndUserVO;
import com.ruoyi.car.vo.UseAndListAndUserAndDeptVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.car.mapper.TmdCarUseMapper;
import com.ruoyi.car.domain.TmdCarUse;
import com.ruoyi.car.service.ITmdCarUseService;
import com.ruoyi.common.core.text.Convert;

/**
 * 用车申请Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-23
 */
@Service
public class TmdCarUseServiceImpl implements ITmdCarUseService 
{
    @Autowired
    private TmdCarUseMapper tmdCarUseMapper;

    /**
     * 查询用车申请
     * 
     * @param id 用车申请主键
     * @return 用车申请
     */
    @Override
    public UseAndListAndUserAndDeptVO selectTmdCarUseById(Long id)
    {
        return tmdCarUseMapper.selectTmdCarUseById(id);
    }

    /**
     * 查询用车申请列表
     * 
     * @param tmdCarUse 用车申请
     * @return 用车申请
     */
    @Override
    public List<UseAndCarListAndUserVO> selectTmdCarUseList(UseAndCarListAndUserVO tmdCarUse)
    {
        List<UseAndCarListAndUserVO> useAndCarListAndUserVOS = tmdCarUseMapper.selectTmdCarUseList(tmdCarUse);
        return useAndCarListAndUserVOS;
    }

    /**
     * 新增用车申请
     * 
     * @param tmdCarUse 用车申请
     * @return 结果
     */
    @Override
    public int insertTmdCarUse(TmdCarUse tmdCarUse)
    {
        return tmdCarUseMapper.insertTmdCarUse(tmdCarUse);
    }

    /**
     * 修改用车申请
     * 
     * @param tmdCarUse 用车申请
     * @return 结果
     */
    @Override
    public int updateTmdCarUse(TmdCarUse tmdCarUse)
    {
        return tmdCarUseMapper.updateTmdCarUse(tmdCarUse);
    }

    /**
     * 批量删除用车申请
     * 
     * @param ids 需要删除的用车申请主键
     * @return 结果
     */
    @Override
    public int deleteTmdCarUseByIds(String ids)
    {
        return tmdCarUseMapper.deleteTmdCarUseByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用车申请信息
     * 
     * @param id 用车申请主键
     * @return 结果
     */
    @Override
    public int deleteTmdCarUseById(Long id)
    {
        return tmdCarUseMapper.deleteTmdCarUseById(id);
    }

    @Override
    public int returnCar(Long id) {
        return tmdCarUseMapper.returnCar(id);
    }

    @Override
    public int updateStatus(Long id) {
        return tmdCarUseMapper.updateStatus(id);
    }
}
